function dump()
{
    var s = "";

    for (i in arguments) {
        s += arguments[i];
    }

    s += "<br />";

    document.write(s);
}

document.addEventListener("keypress", function(e){
    if (e.key == 'h') {
        var e = document.querySelector(".top");
        if (e.hidden === true)
            e.hidden = false;
        else
            e.hidden = true;
    }
});

function getid() {
    var e = document.getElementById("top");
    // e.hidden = true;
    // e.style.border = "1px #000 solid";
    // e.innerHTML = "新内容";

    e.addEventListener("mouseover", function(){
        // this.style.border = "1px #ff0000 solid";
        e.classList.add("www");
    });

    e.addEventListener("mouseout", function(){
        // this.style.border = "";
        e.classList.remove("www");
    });
}
// getid();

function getTagName()
{
    var tag = document.getElementsByTagName("li");
    var cls = document.getElementsByClassName("nav");

    dump(tag, ", ", cls);
    dump("TagName length: ", tag.length);
    tag[0].innerHTML = "MENU1";
    tag.item(1).innerHTML = "MENU2";
    dump("ClassName length: ", cls.length);


}
getTagName();

